\b\fs<12>Amiga's come in a variety of configurations including models that use the Motorola 68000, the 68020 and now the 68030. While it's not that difficult to figure out which CPU you're using by trying certain instructions and trapping the exception if they break, this isn't necessary. In fact, the Amiga OS sets an ExecBase flag on system startup that can identify which processor (and coprocessor) is installed. The CPU type flags are stored in ExecBase->AttnFlags.
Under V1.3 and earlier versions of the OS, the system can't tell the difference between a 68020 and a 68030, or a 68881 and a 68882. That's no big surprise, since both the 68030 and 68882 were introduced well after the last version of the OS was released. Under the new V2.0 version of the operating system, support for identifying these processors has been added. If you are running under V2.0 of the operating system, you can just look at ExecBase->AttnFlags to find out what processor is installed. The AttnFlags field will be set as follows:
\ff<Courier>\fs<8>/****** V2.0 Bit defines for AttnFlags ************************/
/* Processors and Co-processors: */
#define AFB_68010\s0\s/* also set for 68020 */
#define AFB_68020\s1\s/* also set for 68030 */
#define AFB_68030\s2\s/* New flag under V2.0 */
#define AFB_68040\s3\s/* New flag under V2.0 */
#define AFB_68881\s4\s/* also set for 68882 */
#define AFB_68882\s5\s/* New flag under V2.0 */
#define AFF_68010\s(1L<<0)
#define AFF_68020\s(1L<<1)
#define AFF_68030\s(1L<<2)\s/* New flag under V2.0 */
#define AFF_68040\s(1L<<3)\s/* New flag under V2.0 */
#define AFF_68881\s(1L<<4)
#define AFF_68882\s(1L<<5)\s/* New flag under V2.0 */\ff<Times>
\fs<12>
However, if you are running under V1.3 or earlier versions of the operating system, this method will not work with the 68030 and 68882 processors. To overcome this problem you can use the code shown below to identify which CPU the system is using under V1.3. There are three functions to link with your code to identify the processor and coprocessor: GetCPUType(), GetFPUType(), and GetMMUType().
\B\ff<Courier>\fs<9>ULONG GetCPUType(void)\b
\s\ff<Times>\fs<12>Returns a number, representing the type of CPU in the system: 68000L, 68010L,
\s68020L, or 68030L.\ff<Courier>\fs<9>
\BULONG GetFPUType(void)\b
\s\ff<Times>\fs<12>Returns a number, representing the type of FPU in the system: 0L (no FPU), 68881L,
\sor 68882L.\ff<Courier>\fs<9>
\BULONG GetMMUType(void)\b
\s\ff<Times>\fs<12>Returns a number, representing the type of MMU in the system: 0L (no MMU), \s68851L, 68030L, or 0xFFFFFFFFL (this means an FPU responding to a MMU
\saddress).
In order to find out which processor is present, GetCPUType() first checks ExecBase->AttnFlags. Under V1.3 if this is set to AFF_68020, then the processor may be either a 68020 or a 68030. GetCPUType() then checks to see if the processor is really a 68030 by trying to invert the instruction burst enable bit, which doesn't exist on the 68020. If that bit can be changed, then it is a 68030 system.
Similar methods are used in GetMMUType() and GetFPUType(). These functions first look at ExecBase->AttnFlags and then do extra tests based on unique features of a given coprocessor to find out what is present in the system. The functions are listed below.\ff<Courier>\fs<7>